package com.cty.contoller;


import com.cty.entity.User;
import com.cty.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chengtianyao
 * @since 2022-05-30
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    IUserService userService;
    @RequestMapping("list")
    public ResponseEntity list(){
        List<User> list = userService.list();
        for (User user : list) {
            System.out.println(user);
        }
        return new ResponseEntity(list, HttpStatus.OK);
    }
}
